<template>
	<view class="data-list">
		<view class="item" v-for="(item,index) in dataList" :key="index" @click="handleGoodsDetail(item)">
			<image class="img-99" src="@/static/flea/99.png"></image>
			<image class="item-img" :src="getImg(item.imgurl)" mode="widthFix" :lazy-load="true"></image>
			<view class="item-title"> {{item.extension_title}}</view>
			<view class="trend"></view>
			<view class="now-price">
				￥ {{item.min_price}}天
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "dataList",
		props: {
			dataList: Array,
		},
		methods: {
			getImg(url) {
				return getApp().globalData.baseImg + url;
			},
			handleGoodsDetail(item) {
				uni.navigateTo({
					url: `/pagesA/category/goods/productDetails/productDetails?id=${ item.goods_id }`
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.data-list {
		display: flex;
		flex-wrap: wrap;
		min-height: 300rpx;

		.item {
			width: 218rpx;
			border-radius: 16rpx;
			margin-right: 8rpx;
			background-color: white;
			margin-bottom: 8rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			position: relative;
			padding-bottom: 20rpx;

			&:nth-of-type(3n) {
				margin-right: 0;
			}

			.img-99 {
				width: 60rpx;
				height: 38.2rpx;
				position: absolute;
				left: -4rpx;
				top: 0;
				z-index: 1;
			}

			.item-img {
				margin-top: 8rpx;
				width: 136rpx;
			}

			.item-title {
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
				font-size: 20rpx;
				width: 204rpx;
				height: 24rpx;
				text-align: center;
			}

			.trend {
				width: 204rpx;
				height: 40rpx;
				background-image: url("@/static/flea/trend.png");
				background-size: cover;
				position: relative;
				margin-top: 10rpx;
			}

			.now-price {
				margin-top: 8rpx;
				width: 160rpx;
				height: 44rpx;
				text-align: center;
				line-height: 44rpx;
				color: white;
				font-size: 20rpx;
				font-weight: bold;
				background: linear-gradient(180deg, #FF814A 27%, #FF540A 69%, #FF0600 100%);
				box-shadow: 0rpx 4rpx 4rpx 0rpx rgba(255, 129, 74, 0.35);
				border-radius: 58rpx 58rpx 58rpx 58rpx;
			}
		}
	}
</style>
